package com.lenovo.leos.filebrowser.engine.util;

import java.util.HashMap;
import java.util.Map;

public class MimeTypes {

	private Map<String, String> mMimeTypes = null;

	public MimeTypes() {
		if (null == mMimeTypes)
			mMimeTypes = new HashMap<String,String>();		
	}
		
	public void put(String type, String extension) {
		mMimeTypes.put(type, extension);
	}
		
	public String getMimeType(String filename) {
		
		String extension = FileUtil.getExtension(filename);
		Log.d("tag", "=========================" + extension);
		String mimetype = mMimeTypes.get(extension);
		//add by xieqm 110124
		if(mimetype == null)
			mimetype = "fileBrowserNoMimetype";
		Log.d("tag", "=========================" + mimetype);
		//
		return mimetype;
	}
	
	public String getDefaultFolderOfMimeType(String mimetype){
		
        String defaultfolder = mMimeTypes.get(mimetype);
        return defaultfolder;
        
}
}
